//
//  LKDailyChartHeaderCell.m
//  YLHelper
//
//  Created by she1323 on 2018/8/8.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKDailyChartHeaderCell.h"

@implementation LKDailyChartHeaderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    if (iPhoneX) {
        [self.segmentControl mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.mas_top).offset(STATUS_BAR_HEIGHT);
        }];
    }
    self.segmentControl.layer.cornerRadius = 5;
    self.segmentControl.layer.masksToBounds = YES;
    self.segmentControl.tintColor = [UIColor whiteColor];
    self.segmentControl.backgroundColor = blueDefault;
    self.segmentControl.layer.borderColor = blueDefault.CGColor;
    self.segmentControl.layer.borderWidth = 1;
    //通过Attribute字符串属性字典设置Segment标签属性(正常状态下)
    [self.segmentControl setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]} forState:UIControlStateNormal];
    //通过Attribute字符串属性字典设置Segment标签属性(选中状态下)
    [self.segmentControl setTitleTextAttributes:@{NSForegroundColorAttributeName:blueDefault} forState:UIControlStateSelected];
    UIImageView *bgImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:bgImageView];
    [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.top.equalTo(self.contentView).with.insets(UIEdgeInsetsZero);
    }];
    bgImageView.image = [UIImage imageNamed:@"08bg"];
    [self.contentView sendSubviewToBack:bgImageView];
    bgImageView.userInteractionEnabled = YES;
    self.sortRankBtn.backgroundColor = ColorRGB(140, 149, 255);
    [self setSpecialCorial:self.sortRankBtn];
    // Initialization code
}

/**
 切指定的位置的圆角

 @param view2 所切view
 */
-(void)setSpecialCorial:(UIView *)view2{
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view2.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = view2.bounds;
    maskLayer.path = maskPath.CGPath;
    view2.layer.mask = maskLayer;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
